package com.sky.blog.service.aop.aspect;

import com.sky.blog.dao.pojo.SysUser;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author sky  2022/3/26
 * @version 1.0
 */

//@Aspect
@Component
public class SysUserAspect {

    @Pointcut("execution(* com.sky.blog.dao.mapper.SysUserMapper.insert(..))")
    public void service() {

    }

    @Before("service()")
    public void before(JoinPoint joinPoint) {
        SysUser arg = (SysUser) joinPoint.getArgs()[0];
        arg.setAccountNonExpired(1);
        arg.setAccountNonLocked(1);
        arg.setCredentialsNonExpired(1);
        arg.setEnabled(1);
        arg.setVersion(1);
        System.out.println("切入------->" + arg);
    }

}
